# coding = utf-8

from selenium import webdriver
from time import sleep
from idNumber import  IdNumber
from idName import  IdName

sfz = IdNumber(2)
ids = sfz.generate_myid()

for index in range(len(ids)):
    browser = webdriver.Chrome()

    browser.get("http://booking.36zc.cn/yuyue/")
    sleep(1)

    browser.find_element_by_xpath('//*[@id="days"]/li[7]').click()

    sleep(1)

    browser.find_element_by_xpath('//*[@id="times"]/li[3]').click()

    sleep(1)

    browser.find_element_by_xpath('//*[@id="context"]/div[2]/button').click()

    name = IdName(1)
    nickname = name.random_name()

    browser.find_element_by_xpath('//*[@id="person-info"]/tr/td[3]/div/input').send_keys(nickname)

    sleep(1)

    browser.find_element_by_xpath('//*[@id="person-info"]/tr/td[5]/div/input').send_keys(ids[index])

    sleep(1)

    browser.find_element_by_xpath('//*[@id="app"]/div/div/div[2]/div/form/div[3]/input').click()

    sleep(1)

    browser.find_element_by_xpath('//*[@id="app"]/div/div/div[2]/div/div/input[2]').click()

    sleep(0.5)
    print(index)
    browser.quit()